package ysq.xyg.web.model.po;

import lombok.NoArgsConstructor;

import lombok.Data;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;
import ysq.xyg.sys.model.po.SysUser;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 网站模块-网站导航实体类
 *
 * @author shengQiang yu
 * @date 2019-6-4 21:16:29
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_web_navigation")
public class WebNavigation implements Serializable{

	/**
     * id
     */ 
	@Id
	private String id;
	/**
	 * 使用类型:1、网页端，2、移动端
	 */
	@Column(name = "use_type")
	private String useType;
	/**
     * 导航名称
     */ 
	@Column(name = "name")
	private String name;
	
	/**
     * 导航类型:1、目录，2、菜单
     */ 
	@Column(name = "nav_type")
	private String navType;
	
	/**
     * 导航级别
     */ 
	@Column(name = "grade")
	private String grade;
	
	/**
     * 跳转连接
     */ 
	@Column(name = "url")
	private String url;
	
	/**
     * 导航code值，以2位数叠加
     */ 
	@Column(name = "nav_code")
	private String navCode;
	
	/**
     * 父类id
     */ 
	@Column(name = "parent_id")
	private String parentId;
	
	/**
     * 排序号，数据越大越往前
     */ 
	@Column(name = "sort")
	private String sort;
	
	/**
     * 是否展示:1、是，2、否
     */ 
	@Column(name = "show_type")
	private String showType;

	/**
     * 用户id
     */
	@Column(name = "user_id")
	private String userId;
	
	/**
     * 删除标识：1、正常，2、已删除
     */ 
	@Column(name = "remove_tag")
	private String removeTag;
	
	/**
     * 创建人
     */ 
	@Column(name = "create_user")
	private String createUser;
	
	/**
     * 创建时间
     */ 
	@Column(name = "create_time")
	private Date createTime;
	
	/**
     * 修改人
     */ 
	@Column(name = "update_user")
	private String updateUser;
	
	/**
     * 修改时间
     */ 
	@Column(name = "update_time")
	private Date updateTime;

	/**
	 * 父类导航名称
	 */
	@Transient
	private String parentName;
	/**
	 * 子类菜单集合
	 */
	@Transient
	private List<WebNavigation> childNavMenuList;

	public WebNavigation(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}